﻿using Domain.Factory_Modeling;
using Domain.Material_Management;
using Domain.Process_Procedures;
using Domain.Production_Modules;
using MediatR;
using MES.Server.API.Application.Command.Production_Modules;
using MES.Server.API.Application.Command.Production_Modules.Pulldown;
using MES.Server.API.Application.Handler.Production_Modules.Pulldown;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ReturnValue;

namespace MES.Server.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PulldownController : ControllerBase
    {
        IMediator mediator;
        public PulldownController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 客户
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<ClientModel>>> GetClient()
        {
            ClientQueryCommand command = new ClientQueryCommand();
            return  mediator.Send(command);
        }
        /// <summary>
        /// 工艺
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<ProcessFlowModel>>> GetProcessFlow()
        {
            ProcessFlowQueryCommand command = new ProcessFlowQueryCommand();
            return mediator.Send(command);
        }
        /// <summary>
        /// 物料群组
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<MaterialGroupModel>>> GetGroup()
        {
            MaterialGroupQueryCommand command = new MaterialGroupQueryCommand();
            return mediator.Send(command);
        }
        /// <summary>
        /// 产线
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<ProductionLineModel>>> GetLine()
        {
            ProductionLineInfoQueryCommand command = new ProductionLineInfoQueryCommand();
            return mediator.Send(command);
        }
        /// <summary>
        /// 工单详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<ProduceModel>>> getProduce([FromQuery] GetProduceQueryCommand command)
        {
           
            return mediator.Send(command);
        }
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<OrderModel>>> getOrder([FromQuery] OrderQueryCommand command)
        {

            return mediator.Send(command);
        }
        /// <summary>
        /// 查询仓库
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<WarehouseModel>>> getWare([FromQuery] GetWarehouseQueryCommand command)
        {

            return mediator.Send(command);
        }
        /// <summary>
        /// 查询仓库
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<WorkShopModel>>> getWork([FromQuery] WorkShowQueryCommand command)
        {

            return mediator.Send(command);
        }
    }
}
